<?php
/*
+--------------------------------------------------------------------------
|   AffiliStore 2
|   ========================================
|   Web: http://www.affilistore.com
|   Email: admin (at) affilistore (dot) com
|	License Type: AffiliStore 2 is NOT open source software and limitations apply 
|   Licence Info: Visit AffiliStore website and click on 'Licence'
+--------------------------------------------------------------------------
*/
if (eregi(".inc.php",$HTTP_SERVER_VARS['PHP_SELF']) || eregi(".inc.php",$_SERVER['PHP_SELF'])) {
	echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>";
	exit;
}



// sub page listing
$sql = sprintf("SELECT * FROM affiliSt_pages WHERE parent = %s ORDER BY name ASC",
				quote_smart($_GET['page']));
$getPageLinksSub = mysql_query($sql, $databaseConnect) or die(mysql_error());
$pageLinksSub = mysql_fetch_assoc($getPageLinksSub);

$box_content = new XTemplate ("skins/".$configSkin['value']."/styleTemplates/pagelinkstopsub.tpl");
$storedCategory = '';


// create navigation from category and brond list
do { 
	if ($pageLinksSub['id'] != NULL && $pageLinksSub['parent'] != 0) {
	$catresult = $pageLinksSub['id'];
		if ($storedCategory != $catresult) {
		
		
		// get link location options
		$linkOpt = explode(":", $pageLinksSub['location']);
			if ($linkOpt[0] == 1) {
		
				if ($catresult == $_GET['subpage']) {
						$box_content->assign("SUBLINKSTYLE",'subTopNavOn');
				} else {
						$box_content->assign("SUBLINKSTYLE",'subTopNavOff');
				}
					
				if ($navOpt[7] == 1) {
				// html perma
				$box_content->assign("SUBLINKDATA",$installDir['value'].'subpage/'.strip_tags($_GET['page']).'/'.$catresult.'/'.urltxt($pageLinksSub['name']).'.html');
						} else {
				// php link
				$box_content->assign("SUBLINKDATA",$installDir['value'].'index.php?case=subpage&page='.strip_tags($_GET['page']).'&subpage='.$catresult);
						}
			$box_content->assign("DATA",$pageLinksSub['name']);
			$box_content->parse("pagelinkstopsub.li");
			
			$storedCategory = $catresult;
			}
		} else {
		$catresult = ucwords(strtolower($pageLinksSub['id']));
		}
	}
} while ($pageLinksSub = mysql_fetch_assoc($getPageLinksSub)); 



			
$box_content->assign("SKIN",$configSkin['value']);
$box_content->parse("pagelinkstopsub");
$box_content = $box_content->text("pagelinkstopsub");
?>